<template>
	<view class="content">
		<view class="di"></view>
			<view class="tou">
				<view class="title">请输入手机号</view>
				<view class="ts">未注册手机验证后将自动登录</view>
				<view class="input-box">
					<view class="left">+86</view>
					<input class="right" placeholder="请输入手机号码" type="number" maxlength="11" v-model="phone" @input="phoneChange" />
				</view>
				<button class="btn1" :disabled="showbtnDisabled" @click="getCode">获取验证码</button>
			</view>
		</view>
	</view>
</template>

<script>
	var _this;
	export default {
		data() {
			return {
				phone:'',
				btnDisabled:true,
			};
		},
		onLoad() {
			_this=this;
			const {aplus_queue} = window;
			aplus_queue.push({
			 action: 'aplus.record',
			  arguments: ['openlogin','1']
			});
		},
		computed:{
			showbtnDisabled :function(){
				if(!this.btnDisabled){
					return false;
				}else{
					return true;
				}
			}
		},
		methods:{
			phoneChange(event){
				_this.btnDisabled=event.detail.value.length==11?false:true;
			},
			getCode(){
				const {aplus_queue} = window;
				aplus_queue.push({
				 action: 'aplus.record',
				  arguments: ['getCode','1']
				});
				_this.$HTTP({
					method: 'GET',
					url: 'shopServer/user/getCode/'+_this.phone,
					data: {
						time: Date.parse(new Date())
					}
					// header:'form'
				}).then(res => {
					uni.navigateTo({
						url:'/pages/index/code?phone='+_this.phone
					})
				}).catch(err => {
					console.log(err);
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
.content {
	width: 100%;
	height: 100vh;
	background-image: url('https://home.miaokaikeji.com/web/applet/newimg/loginbg.png');
	background-size: 100% 100%;
	position: relative;
	.di{
		width: 646rpx;
		height: 58vh;
		background: #FFFFFF;
		border-radius: 40rpx;
		opacity: 0.63;
		position: absolute;
		left: 52rpx;
		top: 26vh;
		z-index: 1;
	}
	.tou{
		width: 686rpx;
		height: 60vh;
		background: #FFFFFF;
		border-radius: 40rpx;
		position: absolute;
		left: 32rpx;
		top: 22vh;
		z-index: 2;
		box-sizing: border-box;
		padding: 72rpx 32rpx 0 32rpx;
		.title{
			width: 100%;
			text-align: center;
			font-size: 48rpx;
			color: #333333;
		}
		.ts{
			width: 100%;
			text-align: center;
			font-size: 28rpx;
			color: #999999;
			margin-top: 10rpx;
		}
		.input-box{
			width: 100%;
			height: 110rpx;
			margin-top: 110rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			border-bottom: 1px solid #F5F5F5;
			.left{
				width: 80rpx;
				font-size: 32rpx;
				color: #333333;
			}
			.right{
				width: calc(100% - 110rpx);
				height: 45rpx;
				font-size: 32rpx;
			}
		}
		.btn1 {
			width: 100%;
			height: 96rpx;
			background: #FF9416;
			border-radius: 59rpx;
			line-height: 96rpx;
			color: white;
			font-size: 36rpx;
			margin-top: 140rpx;
		}
		.btn1[disabled]{
			background: #CCCCCC !important;
		}
		
	}
}
</style>
